﻿using System;
using System.Collections.Generic;
using System.Text;
using Abp.Domain.Entities;
using MySqlX.XDevAPI.Relational;
using System.ComponentModel.DataAnnotations.Schema;

namespace KelonProud.QuickQuery.Domain
{
    [Table("KpQueryGridColumn")]
    public class QueryGridColumn : Entity
    {
        public virtual string Name { get; set; }

        public virtual string Alias { get; set; }

        public virtual bool IsHidden { get; set; }

        public virtual string Width { get; set; }

        public virtual int Order { get; set; }

        public virtual bool IsFilter { get; set; }

        public virtual string FilterConfig { get; set; }

        public virtual string Format { get; set; }

        public virtual TextAlign Align { get; set; }

        public virtual bool IsFrozen { get; set; }

        public virtual int QueryId { get; set; }

        [ForeignKey("QueryId")]
        public virtual QueryGrid Query { get; set; }

        public virtual ICollection<QueryCommand> Commands { get; set; }

        //public virtual AbstractQueryFilter Filter
        //{
        //    get
        //    {
        //        var configs = FilterConfig.Split('!');
        //        var type = (QueryFilter)Enum.Parse(typeof(QueryFilter), configs[0]);
        //        return AbstractQueryFilter.CreateQueryFilter(type, Alias, Name, configs.Length == 1 ? "" : configs[1]);
        //    }
        //}
    }
}
